<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
		<link rel="stylesheet" type="text/css" href="../../css/jquery-weui.min.css" />
		<link rel="stylesheet" type="text/css" href="../../css/index.css" />
		<link rel="stylesheet" type="text/css" href="../../css/order.css" />
		<title>确认运输完毕</title>
		<script src="../../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/baseConfig.js" type="text/javascript" charset="utf-8"></script>
		 <script src=" http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	</head>

	<body>
		<!--<div id="header">
			<div class="header-title" style="position: fixed;top: 0;">
				<img src="../../img/left.png" class="left" />
				<span>运输完毕咨询</span>
			</div>
		</div>-->
		<div class="imgWarp" style="margin-top: 0;">

		</div>
		<div class="demos-content-padded" style="padding: 0.3rem 1.1rem;">
			<a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_default Register" style="float: left;">未运完</a>
			<a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary Login" style="float: right;margin-top: 0;background: #28c81e;">已运完</a>
		</div>

		<!--<div class="weui-gallery" style="display: none">
			<span class="weui-gallery__img">
				<img src=""/>
			</span>
		</div>-->
	</body>
	<script type="text/javascript">
		$(document).ready(function() {
			baseConfig.historyBack()
//			$(".imgWarp img").on("click", function() {
//				var src = $(this).attr("src")
//				$(".weui-gallery").show()
//				$(".weui-gallery__img img").attr("src", src)
//				$(".weui-gallery").on("click", function() {
//					$(this).hide()
//				})
//			})
			$.ajax({
					type: "get",
					url: baseConfig.localHttp + "weChatApi/fgclient/getTranOver",
					async: false,
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					data: {
						orderNo: baseConfig.GetQueryString("orderNo")
					},
					success: function(data) {
						console.log(data)
						var status = baseConfig.GetQueryString("status")
						if(status==1){
							$(".demos-content-padded").hide()
						}else{
							$(".demos-content-padded").show()
						}
						if(data.code == 100) {
							$(".imgWarp").html("<img src="+baseConfig.imglocalHttp+data.content+">")
							var imgsurl = [];
	                        var nowurl = '';
	                        var imgObj = $(".imgWarp img");
	                        for (var i = 0; i < imgObj.length; i++) {
	                            imgsurl[i] = imgObj[i].src;
	                            imgObj[i].onclick = function() {
	                                nowurl = this.src;
	                                wx.previewImage({
	                                    current: nowurl,
	                                    urls: imgsurl
	                                });
	                            }
	                        }
						} else {
							$.toptip(data.content, 1200, 'error')
						}
					},
					error: function() {
						$.hideLoading();
						$.toast("请求失败", "cancel");
					}
				})
			$(".Login").on("click", function() {
				$.ajax({
					type: "get",
					url: baseConfig.localHttp + "weChatApi/fgclient/confirmTransOver",
					async: false,
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					data: {
						orderNo: baseConfig.GetQueryString("orderNo")
					},
					success: function(data) {
						console.log(data)
						if(data.code == 100) {
							$.toptip(data.content, 1200, 'success')
							setTimeout(function() {
								location.href = "mine.html"
							}, 1200)
						} else {
							$.toptip(data.content, 1200, 'error')
						}
					},
					error: function() {
						$.hideLoading();
						$.toast("请求失败", "cancel");
					}
				})
			})
			$(".Register").on("click",function(){
				$.ajax({
					type: "get",
					url: baseConfig.localHttp + "weChatApi/fgclient/cancelTransOver",
					async: false,
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					data: {
						orderNo: baseConfig.GetQueryString("orderNo")
					},
					success: function(data) {
						console.log(data)
						if(data.code == 100) {
							$.toptip(data.content, 1200, 'success')
							setTimeout(function() {
								location.href = "mine.html"
							}, 1200)
						} else {
							$.toptip(data.content, 1200, 'error')
						}
					},
					error: function() {
						$.hideLoading();
						$.toast("请求失败", "cancel");
					}
				})
			})
		})
	</script>

</html>